#define DEBUG
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;
const int maxn=50, mods=1000000007;

int main() {
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);

	static int a[maxn+1];
	static ll f[maxn+1][maxn+1][maxn+1], c[maxn+1][maxn+1];

	for (int i=0; i<=maxn; i++) {
		c[i][0] = 1;
		for (int j=1; j<=i; j++) {
			c[i][j] = (c[i-1][j-1]+c[i-1][j])%mods;
		}
	}

	int t, n;
	scanf("%d", &t);
	for (int ti=1; ti<=t; ti++) {
		scanf("%d", &n);
		for (int i=1; i<=n; i++) scanf("%d", a+i);

		memset(f, 0, sizeof f);
		f[0][0][0] = 1;
		for (int i=1; i<=n; i++) {
			for (int j=0; j<=n; j++) {
				for (int k=0; k<=n; k++) {
					f[i][j][k] = f[i-1][j][k];
					if (j) {
						for (int x=0; x<=k && x<a[i]; x++) {
							f[i][j][k] = (f[i][j][k]+f[i-1][j-1][k-x]*c[k][x]%mods)%mods;
						}
					}
				}
			}
		}

		printf("%d ", n);
		for (int i=2; i<=n; i++) {
			printf("%lld ", f[n][i][i-2]);
		}
		printf("\n");
	}

	fclose(stdin);
	fclose(stdout);
	return 0;
}
